/*eslint-disable*/

/**以特定时间日期格式返回当前时间日期、旧版*/
function getCusFmtTimeDate(dateFmt, timeFmt, weekFmt) {
    let datetime = new Date();
    let EngWeek = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
    let ChsWeek = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];

    /**最终拼合**/
    let finaldateFmt = "";
    let finaltimeFmt = "";
    let finalweekFmt = "";
    /**最终拼合**/

    /**参数表示符**/
    let paret1 = "";
    let paret2 = "";
    let paret3 = "";
    /**参数表示符**/

    /**临时数据存储块**/
    let tempsave1 = "";
    let tempsave2 = "";
    let tempsave3 = "";
    /**临时数据存储块**/

    /**锁定器**/
    let genicfmtd1 = false;
    let genicfmtd2 = false;
    let genicfmtd3 = false;
    /**锁定器**/

    /**日期处理*/
    if (dateFmt === "" || dateFmt === undefined) {
        dateFmt = "yyyy/mm/dd"; //设置默认值
    }
    for (let ione = 0; ione <= dateFmt.length; ione++) {
        /**年份标识符处理**/
        if (dateFmt.charAt(ione) === 'y' || dateFmt.charAt(ione) === "Y") {
            //符合条件的
            paret1 = paret1 + dateFmt.charAt(ione); //拼接字符，获得标识符串，用以获取长度
            genicfmtd1 = true; //锁定器解锁
        } else {
            if (genicfmtd1 === true) {
                tempsave1 = tempsave1 + datetime.getFullYear(); //读取系统中的年份数据
                tempsave1 = tempsave1.substr(tempsave1.length - paret1.length); //根据paret1的长度数来裁剪需要的数据
                if (dateFmt.charAt(ione) !== "" && dateFmt.charAt(ione) !== undefined) {
                    //判断是否还有字符，有就拼接进去
                    tempsave1 = tempsave1 + dateFmt.charAt(ione);
                }
                finaldateFmt = finaldateFmt + tempsave1; //把已经裁剪好的数据拼接赋值到finaldateFmt
                paret1 = ""; //清空参数表示块
                tempsave1 = ""; //清空临时存储块
                genicfmtd1 = false; //锁定器锁定
            }
        }
        /**年份标识符处理**/

        /**月份标识符处理**/
        if (dateFmt.charAt(ione) === 'm' || dateFmt.charAt(ione) === "M") {
            paret2 = paret2 + dateFmt.charAt(ione);
            genicfmtd2 = true;
        } else {
            if (genicfmtd2 === true) {
                tempsave2 = tempsave2 + (datetime.getMonth() + 1);
                tempsave2 = tempsave2.substr(2 - paret2.length);
                if (dateFmt.charAt(ione) !== "" && dateFmt.charAt(ione) !== undefined) {
                    tempsave2 = tempsave2 + dateFmt.charAt(ione);
                }
                finaldateFmt = finaldateFmt + tempsave2;
                paret2 = "";
                tempsave2 = "";
                genicfmtd2 = false;
            }
        }
        /**月份标识符处理**/

        /**日期标识符处理**/
        if (dateFmt.charAt(ione) === 'd' || dateFmt.charAt(ione) === 'D') {
            paret3 = paret3 + dateFmt.charAt(ione);
            genicfmtd3 = true;
        } else {
            if (genicfmtd3 === true) {
                tempsave3 = tempsave3 + datetime.getDate();
                tempsave3 = tempsave3.substr(tempsave3.length - paret3.length);
                if (dateFmt.charAt(ione) !== "" && dateFmt.charAt(ione) !== undefined) {
                    tempsave3 = tempsave3 + dateFmt.charAt(ione);
                }
                finaldateFmt = finaldateFmt + tempsave3;
                paret3 = "";
                tempsave3 = "";
                genicfmtd3 = false;
            }
        }
        /**日期标识符处理**/
    }
    /**日期处理*/

    /**时间处理*/
    if (timeFmt === "" || timeFmt === undefined) {
        timeFmt = "HH:MM";
    }
    for (let itwo = 0; itwo <= timeFmt.length; itwo++) {
        if (timeFmt.charAt(itwo) === "h" || timeFmt.charAt(itwo) === "H") {
            paret1 = paret1 + timeFmt.charAt(itwo);
            genicfmtd1 = true;
        } else {
            if (genicfmtd1 === true) {
                tempsave1 = tempsave1 + datetime.getHours();
                tempsave1 = tempsave1.substr(tempsave1.length - paret1.length);
                if (timeFmt.charAt(itwo) !== "" && timeFmt.charAt(itwo) !== undefined) {
                    tempsave1 = tempsave1 + timeFmt.charAt(itwo);
                }
                finaltimeFmt = finaltimeFmt + tempsave1;
                paret1 = "";
                tempsave1 = "";
                genicfmtd1 = false;
            }
        }

        if (timeFmt.charAt(itwo) === "m" || timeFmt.charAt(itwo) === "M") {
            paret2 = paret2 + timeFmt.charAt(itwo);
            genicfmtd2 = true;
        } else {
            if (genicfmtd2 === true) {
                tempsave2 = tempsave2 + datetime.getMinutes();
                tempsave2 = tempsave2.substr(tempsave2.length - paret2.length);
                if (timeFmt.charAt(itwo) !== "" && timeFmt.charAt(itwo) !== undefined) {
                    tempsave2 = tempsave2 + timeFmt.charAt(itwo);
                }
                finaltimeFmt = finaltimeFmt + tempsave2;
                paret2 = "";
                tempsave2 = "";
                genicfmtd2 = false;
            }
        }

        if (timeFmt.charAt(itwo) === "s" || timeFmt.charAt(itwo) === "S") {
            paret3 = paret3 + timeFmt.charAt(itwo);
            genicfmtd3 = true;
        } else {
            if (genicfmtd3 === true) {
                tempsave3 = tempsave3 + datetime.getSeconds();
                tempsave3 = tempsave3.substr(tempsave3.length - paret3.length);
                if (timeFmt.charAt(itwo) !== undefined && timeFmt.charAt(itwo) !== "") {
                    tempsave3 = tempsave3 + timeFmt.charAt(itwo);
                }
                finaltimeFmt = finaltimeFmt + tempsave3;
                paret3 = "";
                tempsave3 = "";
                genicfmtd3 = false;
            }
        }
    }
    /**时间处理*/

    /**星期的处理**/
    if (weekFmt === "" || weekFmt === undefined || weekFmt === "Eng") {
        finalweekFmt = EngWeek[datetime.getDay()];
    } else if (weekFmt === "Chs") {
        finalweekFmt = ChsWeek[datetime.getDay()];
    }
    /**星期的处理**/

    return (finaldateFmt + " " + finaltimeFmt + " " + finalweekFmt);
}

/**以特定时间日期格式返回当前时间日期、新版*/
function getCustomFormatTimeDate() {
    console.log("正在开发测试！");
    return;
    let getCustomFormatTimeDateTools = this;
    let ToolKit = getCustomFormatTimeDateTools.lightCopy(getCustomFormatTimeDateTools);
    ToolKit.DataTypeDetect({
        _GlobalOperate: {
            enableDict: true, bind: {
                String: {aliasVal: "str", aliasDsc: "为字符串类型"},
                Array: {aliasVal: "arr", aliasDsc: "为数组类型"},
                Object: {aliasVal: "obj", aliasDsc: "为对象类型"},
                Boolean: {aliasVal: "boo", aliasDsc: "为布尔类型"},
                Number: {aliasVal: "num", aliasDsc: "为数字类型"},
                Undefined: {aliasVal: "und", aliasDsc: "未知定义类型"},
                Function: {aliasVal: "fun", aliasDsc: "为函数类型"},
                AsyncFunction: {aliasVal: "anf", aliasDsc: "为异步函数类型"},
                Null: {aliasVal: "nul", aliasDsc: "为空数据类型"},
                process: {aliasVal: "pro", aliasDsc: "Node JS Process对象"}
            }, RetValueType: 0
        }
    });
    let FmtSymbolBase = ['y', 'd', 'm', 'h', 's', ','];
    let FinalDisplayWeekArr;
    let dateFmt;
    let timeFmt;
    let getConfigData;
}

export {getCusFmtTimeDate, getCustomFormatTimeDate};
